package com.bmadmin.domain;

import java.io.Serializable;
import java.util.List;

/**
 * Created by 金玮良 on 2017-12-01.
 */
public class SysPermissionsPOJO implements Serializable,Comparable<SysPermissionsPOJO> {
    private String p_id;
    private String p_url;
    private String p_name;
    private int p_rank;
    private String p_icon;
    private String p_pid;

    private List<SysPermissionsPOJO> children;

    public SysPermissionsPOJO() {
    }

    public SysPermissionsPOJO(String p_id, String p_url, String p_name, int p_rank, String p_icon, String p_pid) {
        this.p_id = p_id;
        this.p_url = p_url;
        this.p_name = p_name;
        this.p_rank = p_rank;
        this.p_icon = p_icon;
        this.p_pid = p_pid;
    }


    @Override
    public String toString() {
        return "SysPermissionsPOJO{" +
                "p_id='" + p_id + '\'' +
                ", p_url='" + p_url + '\'' +
                ", p_name='" + p_name + '\'' +
                ", p_rank='" + p_rank + '\'' +
                ", p_icon='" + p_icon + '\'' +
                ", p_pid='" + p_pid + '\'' +
                ", children=" + children +
                '}';
    }


    public int getP_rank() {
        return p_rank;
    }

    public void setP_rank(int p_rank) {
        this.p_rank = p_rank;
    }

    public List<SysPermissionsPOJO> getChildren() {
        return children;
    }

    public void setChildren(List<SysPermissionsPOJO> children) {
        this.children = children;
    }

    public String getP_id() {
        return p_id;
    }

    public void setP_id(String p_id) {
        this.p_id = p_id;
    }

    public String getP_url() {
        return p_url;
    }

    public void setP_url(String p_url) {
        this.p_url = p_url;
    }

    public String getP_name() {
        return p_name;
    }

    public void setP_name(String p_name) {
        this.p_name = p_name;
    }


    public String getP_icon() {
        return p_icon;
    }

    public void setP_icon(String p_icon) {
        this.p_icon = p_icon;
    }

    public String getP_pid() {
        return p_pid;
    }

    public void setP_pid(String p_pid) {
        this.p_pid = p_pid;
    }

    @Override
    public int compareTo(SysPermissionsPOJO o) {
        if(this.p_rank>o.getP_rank()){
            return (this.p_rank-o.getP_rank());
        }

        if(this.p_rank<o.getP_rank()){
            return (this.p_rank-o.getP_rank());
        }

        return 0;
    }
}
